Data transfer between a host computer and a data storage device typically originates at a source, passes through a data buffer and ends at a destination. Typically, the data buffer comprises a random access memory arranged as a circular first-in-first-out dual port memory. The data buffer compensates for the differing data transfer speeds of the source and of the destination. During a write transaction, the host computer is the source and the storage media of the data storage device is the destination. During a read transaction, the storage media is the source and the host computer is the destination.
For example, during a write transaction from the host computer to the data storage device, the host computer transfers a write data block to the data buffer according to the data transfer speed of the input/output bus coupled between the host computer and the data storage device. The write data block is then transferred from the data buffer to the storage media according to the data transfer speed of the storage media. During a read transaction, a read data block is transferred from the storage media to the data buffer according to the data transfer speed of the storage media, and thereafter transferred from the data buffer to the host computer according to the data transfer speed of the input/output bus.
The data buffer may also function as a cache for frequently accessed data, and for anticipated data accesses. For example, sequential read transactions are common during normal data transfer operations to a disk device. Therefore, read ahead caching may be employed to cache sequential read data blocks from the disk media into the data buffer after a normal read access. If a subsequent host read command is targeted for a read data block stored in the read ahead cache, the read data block is instantly available to the host computer without the normal read/write head positioning overhead. The portions of the data buffer holding cached data are not available to buffer a data transfer sequence.
The data buffer should be managed to provide a smooth continuous data flow between the host computer and the storage media despite the differing data transfer speeds and media positioning overhead. Also, the data buffer should be managed to minimize the occurrences of buffer full and buffer empty conditions during data transfer operations.
One prior art method for managing the data buffer allocates the entire data buffer from a fixed starting location for any host computer read or write transaction regardless of the data size for the transaction. Unfortunately, such a method destroys all cached data even though the transaction may require only a portion of the data buffer.
For example, if the fixed starting location in the data buffer is zero, a read transaction from the host computer causes transfer of a read data block from the disk media to the data buffer starting at location zero. Thereafter, as the read data block is transferred to the host computer, the free data buffer locations starting at zero become available for read ahead caching. However, a subsequent write transaction or a non-sequential read transaction from the host computer causes transfer of a new data block to the data buffer starting at location zero, thereby probably destroying the next sequential and possibly all cached data.
Another prior art method of data buffer management partitions the data buffer into a fixed length write buffer, and a fixed length read buffer. Typically, the read buffer and the write buffer have equal length. However, the resulting limited size of the read and write buffers reduces overall system throughput by increasing the occurrences of buffer full and buffer empty conditions. Moreover, the fixed partitioning of the read and write buffers limits the size of a read ahead cache to the size of the read buffer, even in an all read command stream. As a consequence, several sequential read transactions can rapidly exhaust the cached data, thereby causing delays in execution of a read transaction and reducing system throughput.